/** @file InfoPop.qml
@brief Iconic square button to manage the popup help

InfoPop is a object subloaded by other main objects. Should not
be used for normal operations. Use ButtonIcon instead.
@todo BUG: manage the z-value of the shown popup text to stay always on top of the
screen objects.

@authorname \n
@licenseversion \n
@actualversion - @dateupdate

@licensenote
*/

import QtQuick 1.0
import "Theme.js" as JObj

BorderImage {
    id: button

    source: JObj.getInfoPopIco(objSubLoad.getTheme())
    clip: true
    border { left: 10; top: 10; right: 10; bottom: 10 }
    // object is forced to be square
    height: objSubLoad.getWidth()
    width: objSubLoad.getWidth()

    signal objClickCoord(int x, int y);

    // Shade is set over the button image when it is presed
    Rectangle { id: shade; anchors.fill: button; radius: 5; color: "black"; opacity: 0 }

    MouseArea {
        id: mouseArea; anchors.fill: parent;
        onClicked: { button.objClickCoord(mouseX, mouseY); }
    }

    // When button is pressed the shade changes
    states: State {
        name: "pressed"; when: mouseArea.pressed == true
        PropertyChanges { target: shade; opacity: .2 }
    }
}
